--[[
	Security protected functions
]]

function api.forbidden()
	if Security.level ~= "SECURE" then
		if Security.taint == "" then
			UI.BroadcastEvent("MACRO_ACTION_FORBIDDEN", Security.taint, debug.getinfo(2).name)
		else
			UI.BroadcastEvent("ADDON_ACTION_FORBIDDEN", Security.taint, debug.getinfo(2).name)
		end
		return true
	end
end

function api.blocked()
	if Security.level ~= "SECURE" then
		if Security.taint == "" then
			UI.BroadcastEvent("MACRO_ACTION_BLOCKED", Security.taint, debug.getinfo(2).name)
		else
			UI.BroadcastEvent("ADDON_ACTION_BLOCKED", Security.taint, debug.getinfo(2).name)
		end
		return true
	end
end

function api.incombat()
	if Security.combat then
		return api.blocked()
	end
	return false
end

function api.global.RegisterForSave(name)
	if api.forbidden() then return end

	Addons.RegisterForSave("FrameXML", false, name)
end

function api.global.RegisterForSavePerCharacter(name)
	if api.forbidden() then return end

	Addons.RegisterForSave("FrameXML", true, name)
end

